#import "NSObject+HUD.h"
#import "THProgressView.h"
@implementation NSObject (HUD)
+ (void)setDefaultUI
{
    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeNative];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
    [SVProgressHUD setBackgroundColor:[UIColor blackColor]];
    [SVProgressHUD setBackgroundLayerColor:[UIColor colorWithWhite:0 alpha:0.4]];
    [SVProgressHUD setMinimumDismissTimeInterval:2];
}
- (void)showInfoText:(NSString *)aText
{
    [THProgressView showInfoWithStatus:aText];
    [self dismissLoadingWithDelay];
}
- (void)showText:(NSString *)aText
{
    [THProgressView showImage:nil status:aText];
    [self dismissLoadingWithDelay];
}
- (void)showLoadingWithText:(NSString *)aText
{
    [THProgressView showWithStatus:aText];
}
- (void)showSuccessText:(NSString *)aText
{
    [THProgressView showSuccessWithStatus:aText];
    [self dismissLoadingWithDelay];
}
- (void)showErrorText:(NSString *)aText
{
    [THProgressView showErrorWithStatus:aText];
    [self dismissLoadingWithDelay];
}
- (void)showProgress:(NSInteger)progress
{
    [THProgressView showProgress:progress/100.0 status:[NSString stringWithFormat:@"%li%%",(long)progress]];
}
- (void)showImage:(UIImage*)image text:(NSString*)aText
{
    [THProgressView showImage:image status:aText];
}
- (void)showLoading
{
    [THProgressView setDefaultMaskType:SVProgressHUDMaskTypeClear];
    [THProgressView show];
}
- (void)showLoadingWithMaskTypeClear
{
    [THProgressView setDefaultMaskType:SVProgressHUDMaskTypeClear];
    [THProgressView show];
}
- (void)dismissLoading
{
    [THProgressView dismiss];
}
- (void)dismissLoadingWithDelay {
    [THProgressView dismissWithDelay:2.0f];
}
- (void)showInfoWithText:(NSString *)aText maskType:(SVProgressHUDMaskType)maskType
{
    [THProgressView setDefaultMaskType:maskType];
    [THProgressView showInfoWithStatus:aText];
    [self dismissLoadingWithDelay];
}
- (void)showWithText:(NSString *)aText maskType:(SVProgressHUDMaskType)maskType
{
    [THProgressView setDefaultMaskType:maskType];
    [THProgressView showImage:nil status:aText];
    [self dismissLoadingWithDelay];
}
- (void)showSuccessWithText:(NSString *)aText maskType:(SVProgressHUDMaskType)maskType
{
    [THProgressView setDefaultMaskType:maskType];
    [THProgressView showSuccessWithStatus:aText];
    [self dismissLoadingWithDelay];
}
- (void)showErrorWithText:(NSString *)aText maskType:(SVProgressHUDMaskType)maskType
{
    [THProgressView setDefaultMaskType:maskType];
    [THProgressView showErrorWithStatus:aText];
    [self dismissLoadingWithDelay];
}
- (void)showProgress:(float)progress text:(NSString *)aText maskType:(SVProgressHUDMaskType)maskType
{
    [THProgressView setDefaultMaskType:maskType];
    [THProgressView showProgress:progress/100.0 status:[NSString stringWithFormat:@"%li%%",(long)progress]];
}
- (void)showImage:(UIImage *)image text:(NSString *)aText maskType:(SVProgressHUDMaskType)maskType
{
    [THProgressView setDefaultMaskType:maskType];
    [THProgressView showImage:image status:aText];
}
- (void)showWithMaskType:(SVProgressHUDMaskType)maskType
           AnimationType:(SVProgressHUDAnimationType)AnimationType
                HUDStyle:(SVProgressHUDStyle)HUDStyle
{
}
@end
